<script type="text/javascript">
function changeStatus(obj,index){
   document.getElementById("txtNoDelay_" + index).disabled = ! obj.checked;
   document.getElementById("txtDateDelay_" + index).disabled = ! obj.checked;
   document.getElementById("txtNoPo_" + index).disabled = ! obj.checked;
   document.getElementById("txtsuppliername_" + index).disabled = ! obj.checked;
   document.getElementById("txtProductname_" + index).disabled = ! obj.checked;
   document.getElementById("txtQuantity_" + index).disabled = ! obj.checked;
   document.getElementById("txtDiscount_" + index).disabled = ! obj.checked;
   document.getElementById("txtAmount_" + index).disabled = ! obj.checked;
   document.getElementById("kdeiddetail_" + index).disabled = ! obj.checked;
   document.getElementById("\kdesupplier_" + index).disabled = ! obj.checked;
}
</script>
<form method="post" name="frmSearch" action="<?php echo site_url('delaypembeliancontroller');?>">
    <table width="100%" cellpadding="3" cellspacing="0" border="1">
        <tr>
            <td width="131"><strong>NO PO</strong></td>
            <td width="18" align="center"><strong>:</strong></td>
            <td width="838" colspan="3">
            	<input type="text"  name="pokode" id="pokode" maxlength="12" size="25" >
            	<!--<select name="pokode">
                    <?php 
						$count = count($mstrpo);
                    	foreach($mstrpo as $comboInd)
						{
                    ?>
                    	<option value="<?php echo $comboInd->NoPo?>"><?php echo $comboInd->NoPo;?></option>
                    <?php }?>
                </select>-->
            </td>
		</tr>
        <tr align="center">
        	<td colspan="5" height="25"><input type="submit" name="btnview" value="Search"></td>
    	</tr>
    </table>
</form>
<br />
<div class="cleaner_h10"></div>
<form method="post" name="frmapprove" action="<?php echo site_url('delaypembeliancontroller/approvedelaypembelian');?>">
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
	<tr>
        <td ><strong>Keterangan </strong></td>
        <td width="210" ><input type="text"  name="keterangan" id="keterangan" size="35" maxlength="100" /></td>
    </tr>
    <tr>
        <td colspan="9">&nbsp;</td>
    </tr>
    <tr style="background-color:#FFF; color:#000000;" align="center">
        <td colspan="9" height="25"><strong>LIST PEMBELIAN BARANG TERTUNDA</strong></td>
    </tr>
    <tr style="background-color:#333; color:#FFF;" align="center">
    	<td width="83">&nbsp;</td>
    	<td >Kode Delay</td>
        <td width="94" >Tanggal delay</td>
    	<td width="86" >Kode PO</td>
        <td width="139" >Nama Supplier</td>
        <td width="100" >Nama Barang</td>
        <td width="61" >Quantity</td>
        <td width="64" >Discount</td>
        <td width="102" >Jumlah Harga</td>
    </tr>
	<tbody id="datadelay"><?php
		$i = 0; 
		if(count($transdelay)>0){
			foreach($transdelay as $tdelay){
				$style = "";
				if($i%2 == 0)$style="cellDefault"; else $style="cellAlternate";
	            echo "<tr class=\"".$style."\">";
	            echo "	<td><input type=\"checkbox\" name=\"chkitem[]\" id=\"chkitem[]\" value=\"".$tdelay->KodeDetailBarang."\" onclick=\"javascript:changeStatus(this,".$i.")\" /></td>";
	            echo "  <td><input id=\"txtNoDelay_".$i."\" name=\"txtNoDelay[]\" type=\"text\" class=\"flat-textbox-number\" style=\"text-align:center;\" size=\"100\" maxlength=\"50\" value=\"".$tdelay->Nodelay."\" readonly=\"readonly\" disabled=\"disabled\"/></td>";
	            echo "  <td><input id=\"txtDateDelay_".$i."\" name=\"txtDateDelay[]\" type=\"text\" class=\"flat-textbox-number\" style=\"text-align:center;\" size=\"50\" maxlength=\"50\" value=\"".$tdelay->Datedelay."\" readonly=\"readonly\" disabled=\"disabled\" /></td>";
	            echo "  <td><input id=\"txtNoPo_".$i."\" name=\"txtNoPo[]\" type=\"text\" class=\"flat-textbox-number\" style=\"text-align:left;\" size=\"100\" maxlength=\"30\" value=\"".$tdelay->NoPo."\" readonly=\"readonly\" disabled=\"disabled\" /></td>";
	            echo "  <td><input id=\"txtsuppliername_".$i."\" name=\"txtsuppliername[]\" type=\"text\" class=\"flat-textbox-number\" style=\"text-align:left;\" size=\"100\" maxlength=\"50\" value=\"".$tdelay->suppliername."\" readonly=\"readonly\" disabled=\"disabled\"/></td>";
	            echo "  <td><input id=\"txtProductname_".$i."\" name=\"txtProductname[]\" type=\"text\" class=\"flat-textbox-number\" style=\"text-align:left;\" size=\"100\" maxlength=\"50\" value=\"".$tdelay->Productname."\" readonly=\"readonly\" disabled=\"disabled\"/></td>";
	            echo "  <td><input id=\"txtQuantity_".$i."\" name=\"txtQuantity[]\" type=\"text\" class=\"flat-textbox-number\" style=\"text-align:center;\" value=\"".$tdelay->Quantity."\" readonly=\"readonly\" disabled=\"disabled\"/></td>";
	            echo "  <td><input id=\"txtDiscount_".$i."\" name=\"txtDiscount[]\" type=\"text\" class=\"flat-textbox-number\" style=\"text-align:center;\" value=\"".$tdelay->Discount."\" readonly=\"readonly\" disabled=\"disabled\"/></td>";
	            echo "  <td><input id=\"txtAmount_".$i."\" name=\"txtAmount[]\" type=\"text\" class=\"flat-textbox-number\" style=\"text-align:right;\" value=\"".$tdelay->Amount."\" readonly=\"readonly\" disabled=\"disabled\"/></td>";	                
	            echo "	<input type=\"hidden\"  name=\"kdesupplier[]\" id=\"kdesupplier_".$i."\" size=\"30\" maxlength=\"25\" value=\"".$tdelay->Kodesupplier."\" disabled=\"disabled\" />";
				echo "	<input type=\"hidden\"  name=\"kdeiddetail[]\" id=\"kdeiddetail_".$i."\" size=\"30\" maxlength=\"25\" value=\"".$tdelay->IDdetail."\" disabled=\"disabled\" />";
	            echo "</tr>";
	            $i++;
			}?>
        	
    <?php } else{
            echo "<tr>";
            echo "<td colspan='9' style='text-align:center;color:red;'>No Data To Display</td>";
            echo "</tr>";
    } ?></tbody>
    <?php if(!empty($message))?>{message}
</table>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#000000">
    	<tr class="cellDefault">
			<td colspan="9" align="center"><input type="submit" name="btnapprove" id="btnapprove" value="Approve"> &nbsp;|&nbsp; <input type="button" name="btnClose" value="Back" class="btn" onclick="javascript:window.location='<?php echo site_url('menuhomecontroller'); ?>';" /></td>
		</tr>
    </table>
<?php //echo $links;?>
<div id="transdelay" class="holder"></div>
</form>